package com.example.warehouse.mapper;

import com.example.warehouse.entity.ProductType;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductTypeMapper {

    @Select("SELECT * from product_type")
    List<ProductType> findTypeTree();


    ProductType findTypeByCode(String typeCode);

    @Insert("INSERT INTO product_type (parent_id,type_code, type_name, type_desc) values (#{parentId},#{typeCode},#{typeName},#{typeDesc})")
    void addType(ProductType productType);

    @Delete("DELETE from product_type where type_id=#{ids}")
    void deleteById(Integer ids);

    @Update("UPDATE product_type set type_name=#{typeName},type_desc=#{typeDesc} where type_id=#{typeId} ")
    void updateType(ProductType productType);
}
